/**
* DoDirectPaymentResponseType.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.2.1 Jun 14, 2005 (09:15:57 EDT) WSDL2Java emitter.
*/
package PayPalAPI.api.ebay;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.text.ParseException;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.javacommerce.paypal.ws.NVPConstants;
import eBLBaseComponents.apis.ebay.CurrencyCodeType;
import CoreComponentTypes.apis.ebay.BasicAmountType;
public class DoDirectPaymentResponseType extends eBLBaseComponents.apis.ebay.AbstractResponseType implements NVPConstants, java.io.Serializable {
private static final Log LOG = LogFactory.getLog(DoDirectPaymentResponseType.class.getName());
/**
*
*/
private static final long serialVersionUID = -7156145449518121610L;
/** The amount of the payment as specified by you on DoDirectPaymentRequest. */
private CoreComponentTypes.apis.ebay.BasicAmountType amount;
/** Address Verification System response code. Character limit: One
* single-byte alphanumeric character */
private java.lang.String AVSCode;
/** Result of the CVV2 check by PayPal. */
private java.lang.String CVV2Code;
/** Transaction identification number.
*
* Character length and limitations: 19 characters maximum. */
private java.lang.String transactionID;
public DoDirectPaymentResponseType() {
}
public DoDirectPaymentResponseType(
CoreComponentTypes.apis.ebay.BasicAmountType amount,
java.lang.String AVSCode,
java.lang.String CVV2Code,
java.lang.String transactionID) {
this.amount = amount;
this.AVSCode = AVSCode;
this.CVV2Code = CVV2Code;
this.transactionID = transactionID;
}
public DoDirectPaymentResponseType(InputStream _is) throws UnsupportedEncodingException, IllegalArgumentException, IOException, ParseException {
BufferedReader reader = new BufferedReader(new InputStreamReader(_is));
String currentLine = null;
while ((currentLine = reader.readLine()) != null) {
String[] pairs = StringUtils.split(currentLine, "&");
if (LOG.isDebugEnabled()) {
LOG.debug("Read line [" + currentLine + "], split into " + pairs.length + " pairs.");
}
for (int i = 0; i < pairs.length; i++) {
String[] nvp = StringUtils.split(pairs[i], "=");
String name = nvp[0];
String value = null;
if (nvp.length == 2) {
value = URLDecoder.decode(nvp[1], "UTF-8");
}
if (LOG.isDebugEnabled()) {
LOG.debug("Read pair [" + name + "]/[" + value + "]");
}
if (isCommonField(name)) {
processCommonField(name, value);
}
// Process lines
else if (name.equals(FIELD_AMT) && value != null) {
BasicAmountType amount = new BasicAmountType(value);
setAmount(amount);
}
else if (name.equals(FIELD_AVSCODE) && value != null) {
setAVSCode(value);
}
else if (name.equals(FIELD_CVV2MATCH) && value != null) {
setCVV2Code(value);
}
else if (name.equals(FIELD_TRANSACTIONID) && value != null) {
setTransactionID(value);
}
else if (name.equals(FIELD_CURRENCYCODE) && value != null) {
if (getAmount() == null) {
setAmount(new BasicAmountType());
}
getAmount().setCurrencyID(CurrencyCodeType.fromString(value));
}
else if (LOG.isErrorEnabled()) {
LOG.error("Unknown field returned in DoDirectPayment: [" + name + "]");
}
}
}
}
/**
* Gets the amount value for this DoDirectPaymentResponseType.
*
* @return amount The amount of the payment as specified by you on DoDirectPaymentRequest.
*/
public CoreComponentTypes.apis.ebay.BasicAmountType getAmount() {
return amount;
}
/**
* Sets the amount value for this DoDirectPaymentResponseType.
*
* @param amount The amount of the payment as specified by you on DoDirectPaymentRequest.
*/
public void setAmount(CoreComponentTypes.apis.ebay.BasicAmountType amount) {
this.amount = amount;
}
/**
* Gets the AVSCode value for this DoDirectPaymentResponseType.
*
* @return AVSCode Address Verification System response code. Character limit: One
* single-byte alphanumeric character
*/
public java.lang.String getAVSCode() {
return AVSCode;
}
/**
* Sets the AVSCode value for this DoDirectPaymentResponseType.
*
* @param AVSCode Address Verification System response code. Character limit: One
* single-byte alphanumeric character
*/
public void setAVSCode(java.lang.String AVSCode) {
this.AVSCode = AVSCode;
}
/**
* Gets the CVV2Code value for this DoDirectPaymentResponseType.
*
* @return CVV2Code Result of the CVV2 check by PayPal.
*/
public java.lang.String getCVV2Code() {
return CVV2Code;
}
/**
* Sets the CVV2Code value for this DoDirectPaymentResponseType.
*
* @param CVV2Code Result of the CVV2 check by PayPal.
*/
public void setCVV2Code(java.lang.String CVV2Code) {
this.CVV2Code = CVV2Code;
}
/**
* Gets the transactionID value for this DoDirectPaymentResponseType.
*
* @return transactionID Transaction identification number.
*
* Character length and limitations: 19 characters maximum.
*/
public java.lang.String getTransactionID() {
return transactionID;
}
/**
* Sets the transactionID value for this DoDirectPaymentResponseType.
*
* @param transactionID Transaction identification number.
*
* Character length and limitations: 19 characters maximum.
*/
public void setTransactionID(java.lang.String transactionID) {
this.transactionID = transactionID;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof DoDirectPaymentResponseType)) return false;
DoDirectPaymentResponseType other = (DoDirectPaymentResponseType) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = super.equals(obj) &&
((this.amount==null && other.getAmount()==null) ||
(this.amount!=null &&
this.amount.equals(other.getAmount()))) &&
((this.AVSCode==null && other.getAVSCode()==null) ||
(this.AVSCode!=null &&
this.AVSCode.equals(other.getAVSCode()))) &&
((this.CVV2Code==null && other.getCVV2Code()==null) ||
(this.CVV2Code!=null &&
this.CVV2Code.equals(other.getCVV2Code()))) &&
((this.transactionID==null && other.getTransactionID()==null) ||
(this.transactionID!=null &&
this.transactionID.equals(other.getTransactionID())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = super.hashCode();
if (getAmount() != null) {
_hashCode += getAmount().hashCode();
}
if (getAVSCode() != null) {
_hashCode += getAVSCode().hashCode();
}
if (getCVV2Code() != null) {
_hashCode += getCVV2Code().hashCode();
}
if (getTransactionID() != null) {
_hashCode += getTransactionID().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
}